<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('待办事项')" />
    <link rel="stylesheet" th:href="@{/css/sku_style.css}"/>
</head>
<body class="white-bg">
<div class="container-div">
    <div class="demo-title">待办事项</div>

    <div id="skuTable">
        <table class="skuTable">
            <thead>
            <tr>
                <th style="width: 170px;">项目名称</th>
                <th style="width: 170px;">事项名称</th>
                <th style="width: 170px;display: none">项目id</th>
                <th style="width: 170px;display: none">前置事项id</th>
                <th style="width: 170px;">责任部门</th>
                <th style="width: 170px;">负责人</th>
            </tr>
            </thead>
            <tbody id="mytbody">

            </tbody>
        </table>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var mydata = {};
    $(function (){
        $.ajax({
            url: ctx + "linkong/project/selectProjectByName",
            type: 'POST',
            data: {},
            async: false,
            success: function (data) {
                mydata = data;
            }
        })
        listShow();
    })

    function listShow() {
        var str = "";
            for(var obj in mydata ){
                var myarr = mydata[obj];
                var projectName = myarr.projectName;
                var matterName = myarr.name;
                var projectId = myarr.projectId;
                var mainOrgname = myarr.mainOrgname;
                // var matterContent = myarr.matterContent;
                var proMatterIds = myarr.proMatterIds;
                var approveUsername = myarr.approveUsername;
                str += '<tr>'
                    + '<td rowspan='+ projectName +'><a onclick="auditMatter(' + projectId + ','+ '\'' + proMatterIds + '\')">'+ projectName + '</a></td>'
                    + '<td rowspan='+ matterName + '>'+ matterName + '</td>'
                    + '<td style="display: none" rowspan='+ projectId + '>'+ projectId + '</td>'
                    + '<td style="display: none" rowspan='+ proMatterIds + '>'+ proMatterIds + '</td>'
                    + '<td rowspan='+ mainOrgname + '>'+ mainOrgname + '</td>'
                    + '<td rowspan='+ approveUsername + '>'+ approveUsername + '</td>'
                    + '</tr>';
            }
            $("#mytbody").html(str);
    }
    function auditMatter(proId,ids){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
        // parent.layer.open("审核事项", ctx + "nkong/project/matter_audit/" + proId + "?ids=" + ids,800);

        parent.layer.open({
            type: 2,
            area: [1200 + 'px', 800 + 'px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            title: '审核事项',
            content: '/linkong/project/matter_audit/' + proId + '?ids=' + ids,
            btn: ['关闭'],
            // 弹层外区域关闭
            shadeClose: true,
            cancel: function(index) {
                return true;
            }
        });
    }

    function submitHandler() {
        $.modal.close();
    }

</script>

</body>
</html>